home *** CD-ROM | disk | FTP | other *** search
Text File | 1999-04-08 | 899 b | 51 lines | [TEXT/R*ch] |
- <html>
- <head>
- <title>OpenScript test</title>
- </head>
- <body>
- <h1>MacPerl example:</h1>
- <HR>
-
- <BR><BR>
- First script: Processor
- <BR><BR>
-
- <AppleScript>
- tell application "MacPerl"
- return ¬
- "You are using a " & (Do Script "
- #!perl -w
- use Mac::Gestalt;
-
- my($arch, %archs, $mac);
-
- $arch= $Gestalt{gestaltSysArchitecture()};
- %archs = (gestaltPowerPC() => 'Motorola PowerPC',gestalt68k()=> 'Motorola 68k');
- $mac= (defined($archs{$arch}) ?
- $archs{$arch}: 'an unknown');
-
- MacPerl::Reply($mac);
- ") & " processor."
- end tell
- </AppleScript>
-
- <BR><BR>
- Second script: Year 2000
- <BR><BR>
-
- <AppleScript>
- tell application "MacPerl"
- return ¬
- "Days until the year 2000: " & (Do Script "
- use Time::Local;
- $d1 = timelocal(0,0,0,1,0,100);
- $d2 = ($d1 - time()) / 60 / 60 / 24;
- MacPerl::Reply(int($d2))
- ")
- end tell
- </AppleScript>
-
- <HR>
- </body>
- </html>
-